package test;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.stream.Stream;

public class FileReader implements Runnable {
    private Path path;

    public FileReader(Path path) {
        this.path = path;
    }

    public void run() {
        try (Stream<String> lines = Files.lines(path)) {
            // 处理每一行数据
            lines.forEach(System.out::println);

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
//        ExecutorService executor = Executors.newFixedThreadPool(4);
//        String preFilePath = "/Users/lxp/IdeaProjects/Study/MainTest/data/inData/";
//        Path[] files = {Paths.get(preFilePath+"1.json"), Paths.get(preFilePath+"2.json"), Paths.get(preFilePath+"3.json")};
//
//        for (Path file : files) {
//            executor.execute(new FileReader(file));
//        }
//
//        executor.shutdown();


    }

    private static String processLine(String line) {
        // 对读取的每一行进行处理
        return line.toUpperCase();
    }
}